(def matrix-solve (rows (o float nil))
  "Linear equations solver
   Args:
     rows: (cons -> cons -> num)
       '((11 12 13 1)
         (21 22 23 2)
         (31 32 33 3))
       where:
         11x + 12y + 13z = 1
         21x + 22y + 23z = 2
         31x + 32y + 33z = 3
   Returns:
     (x y z)
   Opt Args:
     * (t): Returns solution as float numbers"
  (forlen n rows
    (= (rows n)
       (map [/ _ ((rows n) n)] (rows n)))
    (forlen m rows
      (unless (is n m)
        (= (rows m)
           (map + (rows m)
                (map [- (* _ ((rows m) n))] (rows n)))))))
  (let solution (map last rows)
    (if float
        (map [+ _ 0.0] solution)
        solution)))
